package team.seekers.catering.common.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import lombok.Getter;

import java.util.Arrays;

@Getter
public enum OrderTypeEnum implements IEnum<Integer> {
    WAIT_ORDER("待支付订单",0),
    /**
     * 等待接单
     */
    FINISH_ORDER("已支付订单", 1);

    private String name;
    private int status;

    OrderTypeEnum(String name, int status) {
        this.name = name;
        this.status = status;
    }

    public static OrderTypeEnum getByStatus(Integer status) {
        return Arrays.stream(values()).filter(e -> e.getStatus() == status).findFirst().orElse(null);
    }

    @Override
    public Integer getValue() {
        return this.status;
    }
}
